#ifndef ADDMODIFYSUPPLIER_H
#define ADDMODIFYSUPPLIER_H

#include <QWidget>
#include "personsupplier.h"

class QLineEdit;
class InquireSql;

enum supplierPage{addSupplierPage, modifySupplierPage};

namespace Ui {
class AddModifySupplier;
}

class AddModifySupplier : public QWidget
{
    Q_OBJECT
    
public:
    explicit AddModifySupplier(QWidget *parent = 0);
    ~AddModifySupplier();
    bool eventFilter(QObject *target, QEvent *event);
    enum LastClickAddModifySupplier {lineEditOwnerName = 2, lineEditContactName,
                   lineEditTel, lineEditEmail, lineEditBankAccount,
                   lineEditAdress, textEditRemark, pushButtonSave};
signals:
     void displaySupplier();
//     void updateComboBoxSupplier();

public slots:
     void slotDisplayAddModifySupplier(int, int);

private slots:

    void on_pushButtonSave_clicked();

    void on_pushButtonCancel_clicked();

protected:
    void keyPressEvent(QKeyEvent *);

private:
    void clearSupplier();
    bool supplierIsEmpty(QLineEdit *, QString);
    Ui::AddModifySupplier *ui;
    supplierList m_list;
    InquireSql *m_sql;
    int currentPage;
    int m_supplierNumber;
    int m_lastClick;
};

#endif // ADDMODIFYSUPPLIER_H
